package demo1;

import java.util.Scanner;

/**
 * @Author liangzai
 * @Description:
 */
public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入4位会员卡号:");
        int a = scanner.nextInt();
        int b = a;
        int sum = 0;
        for (int i = 0; i < 4; i++) {
            sum += a%10;
            a /= 10;
        }
        System.out.println("会员卡号"+b+"各位之和为:"+sum);
        System.out.println("是幸运用户吗？"+(sum>20));
    }

    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] course = {"STB","JAVA","SQL"};
        int[] arr = new int[3];
        for (int i = 0; i < 3; i++) {
            System.out.println("请输入"+course[i]+"课程成绩:");
            arr[i] = scanner.nextInt();
        }
        System.out.println("JAVA与SQL之间的分差："+(arr[1]-arr[2]));
        System.out.println("三门课的平均分:"+(float)(arr[0]+arr[1]+arr[2])/3);
    }
}
